package javafx.demo.pane;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class TestFlowPane extends Application {

	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage stage) {
		stage.setTitle("TitledPane");
		Scene scene = new Scene(new VBox(), 800, 250);
		scene.setFill(Color.GHOSTWHITE);

		FlowPane flow = new FlowPane();
		flow.setPadding(new Insets(5, 0, 5, 0));
		flow.setVgap(4);
		flow.setHgap(4);
		flow.setPrefWrapLength(170); // preferred width allows for two columns
		flow.setStyle("-fx-background-color: DAE6F3");

		ImageView pages[] = new ImageView[8];
		for (int i=0; i<8; i++) {
		     pages[i] = new ImageView(
		   new Image(TestFlowPane.class.getResourceAsStream("../../image/no/chart_"+i+".png")));
		     flow.getChildren().add(pages[i]);
		}

		BorderPane border = new BorderPane();
		border.setTop(flow);

		VBox root = (VBox) scene.getRoot();
		root.getChildren().addAll(border);
		stage.setScene(scene);
		stage.show();
	}

}
